package com.wrupple.muba.catalogs.client.module.services.presentation.impl;

import com.google.inject.Inject;
import com.wrupple.muba.catalogs.client.activity.CatalogActivity;
import com.wrupple.muba.catalogs.client.module.services.presentation.CatalogPlaceInterpret;
import com.wrupple.muba.catalogs.domain.CatalogPlace;
import com.wrupple.muba.common.domain.DesktopPlace;
import com.wrupple.muba.common.domain.FilterData;
import com.wrupple.vegetate.client.module.services.logic.FilterDataSerializationService;

public class MubaCatalogPlaceInterpret implements CatalogPlaceInterpret {

	FilterDataSerializationService serialization;
	
	@Inject
	public MubaCatalogPlaceInterpret(
			FilterDataSerializationService serialization) {
		super();
		this.serialization = serialization;
	}

	@Override
	public String getPlaceCatalog(DesktopPlace item) {
		return item.getProperty(CatalogActivity.CATALOG_ID_PARAMETER);
	}

	@Override
	public String getCurrentPlaceEntry(DesktopPlace item) {
		return item.getProperty(CatalogActivity.CATALOG_ENTRY_PARAMETER);
	}

	@Override
	public FilterData getCurrentPlaceFilterData(DesktopPlace parameter) {
		CatalogPlace place = new CatalogPlace(parameter);
		return place.getFilterData(serialization);
	}

}
